package practioce;

import java.nio.channels.SelectionKey;

/**
 * create by Sun
 * 2018/9/1
 */
public class sorttest {
    //字符串内最长连续上升子序列
    static int max(int[] a){
        int[] max=new int[120];
        for(int i=0;i<a.length;i++){
            max[i]=1;
        }
        int mx=0;
        int j=0;
        for(int i=0;i<a.length-1;i++){
            if(a[i+1]>a[i]){

                max[i+1]=max[i]+1;
            }else {
                max[i+1]=1;
            }
            if(mx<max[i+1]){
                mx=max[i+1];
                j=i+1;
            }
        }
        return j;

    }
    static void maxshangsheng(int[] a){
        //  int[] a={1,6,2,3,19,11,23,44,55,4,0};
        int[] maxlen=new int[a.length];
        for(int i=1;i<a.length;i++){
            for(int j=0;j<i;j++){
                if(a[i]>a[j]){
                    if(maxlen[i]<maxlen[j]+1){
                        maxlen[i]=maxlen[j]+1;
                    }
                }
            }
        }
        int mm=0;
        for(int i=0;i<a.length;i++){

            if(mm<maxlen[i]){
                mm=maxlen[i];
            }
        }
        System.out.println(mm+1);
    }
    public static void main(String[] args) {
       int[] a={1,7,3,5,9,10,4,8};
        System.out.println(max(a));
        maxshangsheng(a);
    }
}
